Skip to content

Conversation

clubby789
Copy link
Contributor

Closes #107703

@rustbot
Copy link
Collaborator

rustbot commented Feb 7, 2023

r? @Mark-Simulacrum

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Feb 7, 2023
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

@clubby789 clubby789 force-pushed the setup-settings-json branch from 78708b0 to 23829a6 Compare February 7, 2023 13:11
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable to me :) I would like to change https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc to point here instead of telling people to copy-paste the config - do you mind making a PR with that change? Ideally it would also point people to src/etc/vscode_settings.json.

I mentioned versioning the config in the original issue - is that something you're interested in working on? It's ok if the answer is no :) I think we can add it in a backwards-compatible way if we go by the hash of the settings.json file instead of using stamp files.

@clubby789
Copy link
Contributor Author

clubby789 commented Feb 7, 2023

What would be best for the versioning? Maybe this:

  1. Store hash of current file as is Actually we can just hash the bundled settings.json, makes updating it easier
  2. Skip the prompt entirely if settings.json exists and has a matching hash
  3. If it exists and the hash does not match, print a note that the file is outdated
  4. Continue with the current logic in the PR (maybe we can overwrite outdated settings.json, copying the current one to a backup)

And I'm happy to make a PR to the dev guide once this one is ready.

@clubby789 clubby789 force-pushed the setup-settings-json branch from 23829a6 to 54861c9 Compare February 7, 2023 15:24
@jyn514
Copy link
Member

jyn514 commented Feb 7, 2023

Store hash of current file as is Actually we can just hash the bundled settings.json, makes updating it easier

I think we need a hash of all historical versions if we want to be able to update old versions without prompting. Otherwise we can't tell apart user-defined configs from old versions of managed configs. That said we don't need a list of hashes right away because for now we can just hash src/etc/vscode_settings.json.

Everything else you said sounds great :)

@clubby789 clubby789 force-pushed the setup-settings-json branch from 54861c9 to e9ff209 Compare February 7, 2023 16:25
@clubby789
Copy link
Contributor Author

clubby789 commented Feb 7, 2023

I decided to add a list of a single hash initially so we can make sure settings.json isn't accidentally updated without adding a new hash.

@jyn514 jyn514 assigned jyn514 and unassigned Mark-Simulacrum Feb 7, 2023
@jyn514 jyn514 changed the title Allow automatically creating vscode settings.json from bootstrap Allow automatically creating vscode settings.json with x setup Feb 7, 2023
@jyn514 jyn514 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 7, 2023
@clubby789 clubby789 force-pushed the setup-settings-json branch from e9ff209 to b695ed9 Compare February 7, 2023 16:53
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great, thanks! r=me with the last nit fixed :)

@clubby789 clubby789 force-pushed the setup-settings-json branch from b695ed9 to eb18293 Compare February 7, 2023 17:12
@jyn514
Copy link
Member

jyn514 commented Feb 7, 2023

@bors r+

thank you!!!

@bors
Copy link
Collaborator

bors commented Feb 7, 2023

📌 Commit eb18293 has been approved by jyn514

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 7, 2023
@RossSmyth
Copy link
Contributor

:ferrisHmm: related
rust-lang/rustc-dev-guide#1545

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 8, 2023
…yn514

Allow automatically creating vscode `settings.json` with `x setup`

Closes rust-lang#107703
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 8, 2023
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#107656 (Bump rust-installer)
 - rust-lang#107757 (Allow automatically creating vscode `settings.json` with `x setup`)
 - rust-lang#107769 (Rename `PointerSized` to `PointerLike`)
 - rust-lang#107770 (rustdoc: use a newline instead of `<br>` to format code headers)
 - rust-lang#107771 (Tweak ICE message)
 - rust-lang#107773 (Clearly signal purpose of the yaml template)
 - rust-lang#107776 (Docs: Fix format of headings in String::reserve)
 - rust-lang#107779 (Remove astconv usage in diagnostic)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@albertlarsan68
Copy link
Member

Is there a check somewhere that verifies that the hash is correctly updated?

@bors bors merged commit b16a321 into rust-lang:master Feb 8, 2023
@rustbot rustbot added this to the 1.69.0 milestone Feb 8, 2023
@clubby789
Copy link
Contributor Author

@albertlarsan68 src/bootstrap/setup/tests.rs tests the last hash matches the current bundled file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create .vscode directory in x.py setup
8 participants